{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0bd21c1d-fda2-455d-b70d-e8b7ad0611f4",
   "metadata": {},
   "source": [
    "# ipympl\n",
    "\n",
    "`ipympl` enables using the interactive features of matplotlib in Jupyter Notebooks, Jupyter Lab, Google Colab, VSCode notebooks, Google Colab\n",
    "\n",
    "Matplotlib requires a live Python kernel to have interactive plots so by default the outputs on this page will not be interactive. To try things out yourself you can either use [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/matplotlib/ipympl/stable?urlpath=retro/notebooks/examples/ipympl.ipynb) or make these docs interactive by clicking on the rocket icon in the top right of the page.\n",
    "\n",
    "\n",
    "## Installation\n",
    "The quickest way to install is either:\n",
    "\n",
    "```bash\n",
    "pip install ipympl\n",
    "```\n",
    "or `conda install -c conda-forge ipympl`\n",
    "\n",
    "\n",
    "For more detailed instructions see [Installing](installing.md).\n",
    "\n",
    "\n",
    "## Basic Example\n",
    "To activate the `ipympl` backend all you need to do is include the `%matplotlib ipympl` magic in the notebook. Alternatively you can use `%matplotlib widget` which will have have the same effect."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2d7b9433-94df-4742-970e-7d9dbb1f6785",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "%matplotlib ipympl\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "fig, ax = plt.subplots()\n",
    "\n",
    "\n",
    "x = np.linspace(0, 2*np.pi, 100)\n",
    "y = np.sin(3*x)\n",
    "ax.plot(x, y)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "52696782-2ecb-4fac-9d90-d5c8f81dac10",
   "metadata": {},
   "source": [
    "With a working Kernel that simple example will give a plot with interactivity enabled in the notebook!\n",
    "![A plot of sine wave, the user pans and zooms with the mouse](_static/basic.apng)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eb0bcca2-f967-46a3-a0aa-9503312acd85",
   "metadata": {},
   "source": [
    "## Install\n",
    "\n",
    "```bash\n",
    "pip install ipympl\n",
    "```\n",
    "\n",
    "\n",
    "\n",
    "```{toctree}\n",
    ":maxdepth: 2\n",
    "\n",
    "installing.md\n",
    "contributing.md\n",
    "```\n",
    "\n",
    "```{toctree}\n",
    ":caption: Examples\n",
    ":maxdepth: 1\n",
    "\n",
    "examples/full-example.ipynb\n",
    "```\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {},
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
